var regApp = {
	_init : function() {
		// $('#submit_btn').on('click', regApp._login);
		$('form').on('keypress', regApp._enterSubmit)
	},
	_isValidMail : function(text) {
		var reMail = /^(?:[a-zA-Z0-9]+[_\-\+\.]?)*[a-zA-Z0-9]+@(?:([a-zA-Z0-9]+[_\-]?)*[a-zA-Z0-9]+\.)+([a-zA-Z]{2,})+$/;
		return reMail.test(text);
	},
	_enterSubmit : function(e) {
		var theEvent = window.event || e;
		var code = theEvent.keyCode || theEvent.which;
		if (code == 13) {
			$("#submit_btn").submit();
		}
	}
};

$(function() {
	regApp._init();
	Placeholders.init(true);
	$("#reg_form").validate({
		rules : {
			loginId : {
				required : true,
				minlength : 3,
				maxlength : 25
			// email : true
			},
			password : {
				required : true,
				minlength : 5
			},
			email : {
				email : true
			}
		},
		messages : {
			loginId : {
				required : "请输入您的帐户名。",
				minlength : "长度应为3-25位字符。",
				maxlength : "长度应为3-25位字符。"
			},
			password : {
				required : "请输入您的密码。",
				minlength : "长度应为5-25位字符。"
			},
			email : {
				email : "邮箱格式应为simple@domain.com。"
			}
		}
	});
});
